package org.example.doris.arrowflightsql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class ArrowFlightDemo {
    public static void main(String[] args) throws Exception {
        Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver");
        String DB_URL = "jdbc:arrow-flight-sql://192.168.0.227:9090?useServerPrepStmts=false"
                + "&cachePrepStmts=true&useSSL=false&useEncryption=false";
        String USER = "root";
        String PASS = "123456";

        Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
        Statement stmt = conn.createStatement();
        ResultSet resultSet = stmt.executeQuery("select * from information_schema.tables;");
        while (resultSet.next()) {
            String tableName = resultSet.getString("TABLE_NAME");
            System.out.println(resultSet +": "+tableName);
        }

        resultSet.close();
        stmt.close();
        conn.close();
    }
}
